#pragma once

#include <QWidget>
#include <QCheckBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QGroupBox>
#include "qcustomplot.h"
#include <qgridlayout.h>
#include <QRadioButton>
#include <qbuttongroup.h>
#include <map>

//pcl
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>

#include "PointCloudViewer.h"
#include "type.h"



class LidarInfo : public QWidget
{
	Q_OBJECT

public:
	LidarInfo(QWidget *parent = Q_NULLPTR);
	~LidarInfo();
	void initUI();
	void setCustomPlotProperty(QCustomPlot* plot);
	void testViewPointCloud();

signals:
	void previewLidar(const QString& lidar);

public slots:
	void onLidarPointPreview(const PointCloud2& pointcloud);
	void onPreviewLidar(int id);
	void onShowLidarRate(const std::vector<TopicHz>& topics_lidar);


private:
	QCustomPlot *topicHzPlot_;
	QGroupBox *groupBox_;

	QGridLayout *lidar_layout_;

	QButtonGroup *lidarGroup_;
	QRadioButton *hesai_lidar_mid_;
	QRadioButton *suteng_front_lidar_;
	QRadioButton *suteng_left_lidar_;
	QRadioButton *suteng_right_lidar_;

	QLabel *hesai_lidar_hz_;
	QLabel *suteng_front_hz_;
	QLabel *suteng_left_hz_;
	QLabel *suteng_right_hz_;

	PointCloudViewer* pointCloudViewer_;

	int currentId_;

	int count_;

	std::map<std::string, std::vector<double> >lidars_rate_;
	std::map<std::string, QCPGraph*> lidar_graph_;
	QStringList lineNames_;
	QStringList topicsList_;
	double key_;

	double max_hz_;
	double min_hz_;
};
